package com.demo.rydemo.jwt.model;

/**
 * @Author ry
 * @Description
 * @Date 2020/8/12 23:24
 */
public class AtomicFinalObject<T> {
    private boolean isInitiated = false;

    private T value;

    public T getValue(){
        return value;
    }

    public synchronized boolean setValue(T value){

        if (isInitiated){
            return false;
        }
        this.isInitiated = true;
        this.value = value;
        return true;
    }
}
